/*
 * @Author: szx
 * @Date: 2021-12-01 13:31:41
 * @LastEditTime: 2021-12-01 13:38:14
 * @Description:
 * @FilePath: \leetcode\400-499\485\485.js
 */
/**
 * @param {number[]} nums
 * @return {number}
 */
var findMaxConsecutiveOnes = function (nums) {
    let maxCount = 0,
        count = 0;
    const n = nums.length;
    for (let i = 0; i < n; i++) {
        if (nums[i] === 1) {
            count++;
        } else {
            maxCount = Math.max(maxCount, count);
            count = 0;
        }
    }
    return Math.max(maxCount, count);
};
